package com.liugege.make.factory.simplefactory.pizzastore.pizza;
/**
* @author: LiuGeGe
* @Date: 2022/3/3 10:36
* @Description(类描述):  简单工厂模式
* @Class(类): SimpleFactory
*/
public class SimpleFactory {
    //根据订购类型，创建对应的披萨
    public  Pizza  createPizza(String orderType){
        System.out.println("简单工厂模式...");
        Pizza pizza = null;
        if ("cheese".equals(orderType)){
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }else if ("pepper".equals(orderType)){
            pizza = new PepperPizza();
            pizza.setName("胡椒披萨");
        }
        return pizza;
    }

    public static Pizza  createPizza1(String orderType){
        System.out.println("简单工厂模式...");
        Pizza pizza = null;
        if ("cheese".equals(orderType)){
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }else if ("pepper".equals(orderType)){
            pizza = new PepperPizza();
            pizza.setName("胡椒披萨");
        }
        return pizza;
    }
}
